home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 081-090 / amok84 / reqtools_2.1d / glue.lha / Glue / HSPascal.1 / interface / Reqtools.pas next >
Pascal/Delphi Source File  |  1992-05-14  |  10KB  |  555 lines

  1. { Reqtools library copyright Nico Francois}
  2.  
  3. {Conversion to Pascal © 1991 Richard Waspe}
  4.  
  5. Unit Reqtools;
  6.  
  7. Interface
  8. Uses Exec, Graphics, Utility;
  9.  
  10.  
  11.  
  12. Const
  13. REQTOOLNAME    =    'reqtools.library';
  14. REQTOOLSVERSION    =    37;
  15.  
  16. Type
  17. Byte = 0..255;
  18. Word = 0..65535;
  19. Long = LongInt;
  20.  
  21. tReqToolsBase    =    Record
  22.                             LibNode            :    tLibrary;
  23.                             Flags                :    byte;
  24.                             Pad                :    Array[0..2] of byte;
  25.                             SegList            :    Pointer;
  26.                             IntuitionBase    :    pLibrary;
  27.                             GfxBase            :    pLibrary;
  28.                             DOSBase            :    pLibrary;
  29.                             GadToolsBase    :    pLibrary;
  30.                             UtilityBase        :    pLibrary;
  31.                         End;
  32.                         
  33. pReqToolsBase    =    ^tReqToolsBase;
  34.                         
  35. Const
  36. RT_FILEREQ : Long = 0;
  37. RT_REQINFO : Long    = 1;
  38. RT_FONTREQ    :    Long    =    2;
  39.  
  40. {*** File Requester ***}
  41. Type
  42.  
  43. rtFileRequester    =    Record
  44.                                 ReqPos        :    Long;
  45.                                 LeftOffset    :    Word;
  46.                                 TopOffset    :    Word;
  47.                                 Flags            :    Long;
  48.                                 Hook            :    pHook;
  49.                                 Dir            :    pCString;
  50.                                 MatchPat        :    pCString;
  51.                                 DefaultFont    :    pTextFont;    
  52.                                 WaitPointer    :    Long;
  53.                             End;
  54.                             
  55. prtFileList = ^rtFileList;
  56.                             
  57. rtFileList    =    Record
  58.                         Next        :    prtFileList;
  59.                         StrLen    :    Long;
  60.                         Name        :    pCString;
  61.                     End;
  62.  
  63.                     
  64. {*** Font Requester ***}
  65.  
  66. rtFontRequester    =    Record
  67.                                 ReqPos        :    Long;
  68.                                 LeftOffset    :    Word;
  69.                                 TopOffset    :    Word;
  70.                                 Flags            :    Long;
  71.                                 Hook            :    pHook;
  72.                                 Attr            :    pTextAttr;
  73.                                 DefaultFont    :    pTextFont;
  74.                                 WaitPointer    :    Long;
  75.                             End;
  76.                             
  77. {*** Requester Info ***}
  78.  
  79. rtReqInfo    =    Record
  80.                         ReqPos        :    Long;
  81.                         LeftOffset    :    Word;
  82.                         TopOffset    :    Word;
  83.                         Width            :    Long;
  84.                         ReqTitle        :    pCString;
  85.                         Flags            :    Long;
  86.                         DefaultFont    :    pTextFont;
  87.                         WaitPointer    :    Long;
  88.                     End;
  89.                     
  90. {*** Handler Info ***)
  91.  
  92. rtHandlerInfo    =    Record;
  93.                             private1        :    Long;
  94.                             WaitMask        :    Long;
  95.                             DoNotWait    :    Long;
  96.                         End;
  97.  
  98. Const CALL_HANDLER    =    $80000000;
  99.  
  100.  
  101. {*** TAGS ***}
  102.  
  103. Const
  104.  
  105. RT_TagBase        =    TAG_USER;           {=$80000000}
  106.  
  107. RT_Window        =    $80000001;
  108. RT_IDCMPFlags    =    $80000002;
  109. RT_ReqPos        =    $80000003;
  110. RT_LeftOffset    =    $80000004;
  111. RT_TopOffset    =    $80000005;
  112. RT_PubScrName    =    $80000006;
  113. RT_Screen        =    $80000007;
  114. RT_ReqHandler    =    $80000008;
  115. RT_DefaultFont    =    $80000009;
  116. RT_WaitPointer    =    $8000000A;
  117.  
  118. RTEZ_ReqTitle            =    $80000014;
  119. RTEZ_Flags                =    $80000016;
  120. RTEZ_DefaultResponse    =    $80000017;
  121.  
  122. RTGL_Min                =    $8000001E;
  123. RTGL_Max                =    $8000001F;
  124. RTGL_Width            =    $80000020;
  125. RTGL_ShowDefault    =    $80000021;
  126.  
  127. RTGS_Width            =    RTGL_Width;
  128. RTGS_AllowEmpty    =    $80000050;
  129.  
  130. RTFI_Flags            =    $80000028;
  131. RTFI_Height            =    $80000029;
  132. RTFI_OkText            =    $8000002A;
  133.  
  134. RTFO_Flags            =    RTFI_Flags;
  135. RTFO_Height            =    RTFI_Height;
  136. RTFO_OkText            =    RTFI_OkText;
  137. RTFO_SampleHeight    =    $8000003C;
  138. RTFO_MinHeight        =    $8000003D;
  139. RTFO_MaxHeight        =    $8000003E;
  140.  
  141. RTFI_Dir                =    $80000032;
  142. RTFI_MatchPat        =    $80000033;
  143. RTFI_AddEntry        =    $80000034;
  144. RTFI_RemoveEntry    =    $80000035;
  145.  
  146. RTFO_FontName        =    $8000003F;
  147. RTFO_FontHeight    =    $80000040;
  148. RTFO_FontStyle        =    $80000041;
  149. RTFO_FontFlags        =    $80000042;
  150.  
  151. RTPA_Color            =    $80000046;
  152. RTRH_EndRequest    =    $8000003C;
  153.  
  154. REQPOS_POINTER        =    0;
  155. REQPOS_CENTERWIN    =    1;
  156. REQPOS_CENTERSCR    =    2;
  157. REQPOS_TOPLEFTWIN    =    3;
  158. REQPOS_TOPLEFTSCR    =    4;
  159.  
  160. FREQB_NOBUFFER        =    2;
  161. FREQF_NOBUFFER        =    4;
  162. FREQB_DOWILDFUNC    =    11;
  163. FREQF_DOWILDFUNC    =    2048;
  164. FREQB_MULTISELECT    =    0;
  165. FREQF_MULTISELECT    =    1;
  166. FREQB_SAVE            =    1;
  167. FREQF_SAVE            =    2;
  168. FREQB_NOFILES        =    3;
  169. FREQF_NOFILES        =    8;
  170. FREQB_PATGAD        =    4;
  171. FREQF_PATGAD        =    16;
  172. FREQB_SELECTDIRS    =    12;
  173. FREQF_SELECTDIRS    =    4096;
  174. FREQB_FIXEDWIDTH    =    5;
  175. FREQF_FIXEDWIDTH    =    32;
  176. FREQB_COLORFONTS    =    6;
  177. FREQF_COLORFONTS    =    64;
  178. FREQB_CHANGEPALETTE    =    7;
  179. FREQF_CHANGEPALETTE    =    128;
  180. FREQB_LEAVEPALETTE    =    8;
  181. FREQF_LEAVEPALETTE    =    256;
  182. FREQB_SCALE            =    9;
  183. FREQF_SCALE            =    512;
  184. FREQB_STYLE            =    10;
  185. FREQF_STYLE            =    1024;
  186.  
  187. EZREQB_NORETURNKEY    =    0;
  188. EZREQF_NORETURNKEY    =    1;
  189. EZREQB_LAMIGAQUAL        =    1;
  190. EZREQF_LAMIGAQUAL        =    2;
  191. EZREQB_CENTERTEXT        =    2;
  192. EZREQF_CENTERTEXT        =    4;
  193.  
  194. REQHOOK_WILDFILE        =    0;
  195. REQHOOK_WILDFONT        =    1;
  196.  
  197.     
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206. Function rtAllocRequestA
  207.          (type_: LongInt;
  208.           taglist: Pointer): Pointer;
  209.  
  210. Procedure rtFreeRequest (req: Pointer);
  211. Function rtFreeReqBuffer (req: Pointer): LongInt;
  212. Function rtChangeReqAttrA
  213.          (req,
  214.           taglist: Pointer): LongInt;
  215.  
  216. Function rtFileRequestA
  217.          (filereq,
  218.           file_,
  219.           title,
  220.           taglist: Pointer): LongInt;
  221.  
  222. Function rtFreeFileList (filelist: Pointer): LongInt;
  223. Function rtEZRequestA
  224.          (bodyfmt,
  225.           gadfmt,
  226.           reqinfo,
  227.           argarray,
  228.           taglist: Pointer): LongInt;
  229.  
  230. Function rtGetStringA
  231.          (buffer: Pointer;
  232.           maxchars: LongInt;
  233.           title,
  234.           reqinfo,
  235.           taglist: Pointer): LongInt;
  236.  
  237. Function rtGetLongA
  238.          (longptr,
  239.           title,
  240.           reqinfo,
  241.           taglist: Pointer): LongInt;
  242.  
  243. Function rtFontRequestA
  244.          (fontreq,
  245.           title,
  246.           taglist: Pointer): LongInt;
  247.  
  248. Function rtPaletteRequestA
  249.          (title,
  250.           reqinfo,
  251.           taglist: Pointer): LongInt;
  252.  
  253. Function rtReqHandlerA
  254.          (handlerinfo: Pointer;
  255.           sigs: LongInt;
  256.           taglist: Pointer): LongInt;
  257.  
  258. Function rtSetWaitPointer (window: Pointer): LongInt;
  259. Function rtGetVScreenSize
  260.          (screen,
  261.           widthptr,
  262.           heightptr: Pointer): LongInt;
  263.  
  264. Function rtSetReqPosition
  265.          (reqpos: LongInt;
  266.           newwindow,
  267.           screen,
  268.           window: Pointer): LongInt;
  269.  
  270. Function rtSpread
  271.          (posarray,
  272.           sizearray: Pointer;
  273.           length,
  274.           min,
  275.           max,
  276.           num: LongInt): LongInt;
  277.  
  278. Function rtScreenToFrontSafely (screen: Pointer): LongInt;
  279.  
  280. Procedure rtEZRequest(a,b : pCstring; x,y : Pointer);
  281.  
  282. Var ReqToolsBase : pReqToolsBase;
  283.  
  284.  
  285. Implementation
  286.  
  287.  
  288.  
  289. Function rtAllocRequestA
  290.          (type_: LongInt;
  291.           taglist: Pointer): LongInt;
  292. XASSEMBLER;
  293. ASM    move.l    a6,-(sp)
  294.     lea    $8(sp),a6
  295.     move.l    (a6)+,a0
  296.     move.l    (a6)+,d0
  297.     move.l    ReqToolsBase,a6
  298.     jsr    -$1E(a6)
  299.     move.l    d0,$10(sp)
  300.     move.l    (sp)+,a6
  301. END;
  302.  
  303. Procedure rtFreeRequest (req: Pointer);
  304. XASSEMBLER;
  305. ASM    move.l    a6,-(sp)
  306.     move.l    $8(sp),a1
  307.     move.l    ReqToolsBase,a6
  308.     jsr    -$24(a6)
  309.     move.l    (sp)+,a6
  310. END;
  311.  
  312. Function rtFreeReqBuffer (req: Pointer): LongInt;
  313. XASSEMBLER;
  314. ASM    move.l    a6,-(sp)
  315.     move.l    $8(sp),a1
  316.     move.l    ReqToolsBase,a6
  317.     jsr    -$2A(a6)
  318.     move.l    d0,$C(sp)
  319.     move.l    (sp)+,a6
  320. END;
  321.  
  322. Function rtChangeReqAttrA
  323.          (req,
  324.           taglist: Pointer): LongInt;
  325. XASSEMBLER;
  326. ASM    move.l    a6,-(sp)
  327.     movem.l    $8(sp),a0-a1
  328.     move.l    ReqToolsBase,a6
  329.     jsr    -$30(a6)
  330.     move.l    d0,$10(sp)
  331.     move.l    (sp)+,a6
  332. END;
  333.  
  334. Function rtFileRequestA
  335.          (filereq,
  336.           file_,
  337.           title,
  338.           taglist: Pointer): LongInt;
  339. XASSEMBLER;
  340. ASM    movem.l    a2-a3/a6,-(sp)
  341.     lea    $10(sp),a6
  342.     move.l    (a6)+,a0
  343.     move.l    (a6)+,a3
  344.     move.l    (a6)+,a2
  345.     move.l    (a6)+,a1
  346.     move.l    ReqToolsBase,a6
  347.     jsr    -$36(a6)
  348.     move.l    d0,$20(sp)
  349.     movem.l    (sp)+,a2-a3/a6
  350. END;
  351.  
  352. Function rtFreeFileList (filelist: Pointer): LongInt;
  353. XASSEMBLER;
  354. ASM    move.l    a6,-(sp)
  355.     move.l    $8(sp),a0
  356.     move.l    ReqToolsBase,a6
  357.     jsr    -$3C(a6)
  358.     move.l    d0,$C(sp)
  359.     move.l    (sp)+,a6
  360. END;
  361.  
  362. Function rtEZRequestA
  363.          (bodyfmt,
  364.           gadfmt,
  365.           reqinfo,
  366.           argarray,
  367.           taglist: Pointer): LongInt;
  368. XASSEMBLER;
  369. ASM    movem.l    a2-a4/a6,-(sp)
  370.     lea    $14(sp),a6
  371.     move.l    (a6)+,a0
  372.     move.l    (a6)+,a4
  373.     move.l    (a6)+,a3
  374.     move.l    (a6)+,a2
  375.     move.l    (a6)+,a1
  376.     move.l    ReqToolsBase,a6
  377.     jsr    -$42(a6)
  378.     move.l    d0,$28(sp)
  379.     movem.l    (sp)+,a2-a4/a6
  380. END;
  381.  
  382. Function rtGetStringA
  383.          (buffer: Pointer;
  384.           maxchars: LongInt;
  385.           title,
  386.           reqinfo,
  387.           taglist: Pointer): LongInt;
  388. XASSEMBLER;
  389. ASM    movem.l    a2-a3/a6,-(sp)
  390.     lea    $10(sp),a6
  391.     move.l    (a6)+,a0
  392.     move.l    (a6)+,a3
  393.     move.l    (a6)+,a2
  394.     move.l    (a6)+,d0
  395.     move.l    (a6)+,a1
  396.     move.l    ReqToolsBase,a6
  397.     jsr    -$48(a6)
  398.     move.l    d0,$24(sp)
  399.     movem.l    (sp)+,a2-a3/a6
  400. END;
  401.  
  402. Function rtGetLongA
  403.          (longptr,
  404.           title,
  405.           reqinfo,
  406.           taglist: Pointer): LongInt;
  407. XASSEMBLER;
  408. ASM    movem.l    a2-a3/a6,-(sp)
  409.     lea    $10(sp),a6
  410.     move.l    (a6)+,a0
  411.     move.l    (a6)+,a3
  412.     move.l    (a6)+,a2
  413.     move.l    (a6)+,a1
  414.     move.l    ReqToolsBase,a6
  415.     jsr    -$4E(a6)
  416.     move.l    d0,$20(sp)
  417.     movem.l    (sp)+,a2-a3/a6
  418. END;
  419.  
  420. Function rtFontRequestA
  421.          (fontreq,
  422.           title,
  423.           taglist: Pointer): LongInt;
  424. XASSEMBLER;
  425. ASM    movem.l    a3/a6,-(sp)
  426.     lea    $C(sp),a6
  427.     move.l    (a6)+,a0
  428.     move.l    (a6)+,a3
  429.     move.l    (a6)+,a1
  430.     move.l    ReqToolsBase,a6
  431.     jsr    -$60(a6)
  432.     move.l    d0,$18(sp)
  433.     movem.l    (sp)+,a3/a6
  434. END;
  435.  
  436. Function rtPaletteRequestA
  437.          (title,
  438.           reqinfo,
  439.           taglist: Pointer): LongInt;
  440. XASSEMBLER;
  441. ASM    movem.l    a2-a3/a6,-(sp)
  442.     lea    $10(sp),a6
  443.     move.l    (a6)+,a0
  444.     move.l    (a6)+,a3
  445.     move.l    (a6)+,a2
  446.     move.l    ReqToolsBase,a6
  447.     jsr    -$66(a6)
  448.     move.l    d0,$1C(sp)
  449.     movem.l    (sp)+,a2-a3/a6
  450. END;
  451.  
  452. Function rtReqHandlerA
  453.          (handlerinfo: Pointer;
  454.           sigs: LongInt;
  455.           taglist: Pointer): LongInt;
  456. XASSEMBLER;
  457. ASM    move.l    a6,-(sp)
  458.     lea    $8(sp),a6
  459.     move.l    (a6)+,a0
  460.     move.l    (a6)+,d0
  461.     move.l    (a6)+,a1
  462.     move.l    ReqToolsBase,a6
  463.     jsr    -$6C(a6)
  464.     move.l    d0,$14(sp)
  465.     move.l    (sp)+,a6
  466. END;
  467.  
  468. Function rtSetWaitPointer (window: Pointer): LongInt;
  469. XASSEMBLER;
  470. ASM    move.l    a6,-(sp)
  471.     move.l    $8(sp),a0
  472.     move.l    ReqToolsBase,a6
  473.     jsr    -$72(a6)
  474.     move.l    d0,$C(sp)
  475.     move.l    (sp)+,a6
  476. END;
  477.  
  478. Function rtGetVScreenSize
  479.          (screen,
  480.           widthptr,
  481.           heightptr: Pointer): LongInt;
  482. XASSEMBLER;
  483. ASM    movem.l    a2/a6,-(sp)
  484.     lea    $C(sp),a6
  485.     move.l    (a6)+,a2
  486.     move.l    (a6)+,a1
  487.     move.l    (a6)+,a0
  488.     move.l    ReqToolsBase,a6
  489.     jsr    -$78(a6)
  490.     move.l    d0,$18(sp)
  491.     movem.l    (sp)+,a2/a6
  492. END;
  493.  
  494. Function rtSetReqPosition
  495.          (reqpos: LongInt;
  496.           newwindow,
  497.           screen,
  498.           window: Pointer): LongInt;
  499. XASSEMBLER;
  500. ASM    movem.l    a2/a6,-(sp)
  501.     lea    $C(sp),a6
  502.     move.l    (a6)+,a2
  503.     move.l    (a6)+,a1
  504.     move.l    (a6)+,a0
  505.     move.l    (a6)+,d0
  506.     move.l    ReqToolsBase,a6
  507.     jsr    -$7E(a6)
  508.     move.l    d0,$1C(sp)
  509.     movem.l    (sp)+,a2/a6
  510. END;
  511.  
  512. Function rtSpread
  513.          (posarray,
  514.           sizearray: Pointer;
  515.           length,
  516.           min,
  517.           max,
  518.           num: LongInt): LongInt;
  519. XASSEMBLER;
  520. ASM    movem.l    d3/a6,-(sp)
  521.     lea    $C(sp),a6
  522.     move.l    (a6)+,d3
  523.     move.l    (a6)+,d2
  524.     move.l    (a6)+,d1
  525.     move.l    (a6)+,d0
  526.     move.l    (a6)+,a1
  527.     move.l    (a6)+,a0
  528.     move.l    ReqToolsBase,a6
  529.     jsr    -$84(a6)
  530.     move.l    d0,$24(sp)
  531.     movem.l    (sp)+,d3/a6
  532. END;
  533.  
  534. Function rtScreenToFrontSafely (screen: Pointer): LongInt;
  535. XASSEMBLER;
  536. ASM    move.l    a6,-(sp)
  537.     move.l    $8(sp),a0
  538.     move.l    ReqToolsBase,a6
  539.     jsr    -$8A(a6)
  540.     move.l    d0,$C(sp)
  541.     move.l    (sp)+,a6
  542. END;
  543.  
  544. Procedure rtEZrequest(a,b : pCstring; X,y : Pointer);
  545. XASSEMBLER;
  546. ASM    movem.l    a2/a3/a4/a6,-(a7)
  547.         move.l    ReqToolsBase,a6
  548.         movem.l    20(a7),a1/a2/a3
  549.         move.l    32(a7),a0
  550.         lea        36(a7),a4
  551.         jsr        -$42(a6)
  552.         movem.l    (a7)+,a2/a3/a4/a6
  553. End;
  554.          
  555. End.